<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ajax测试</title>
    <script type="text/javascript">
        window.onload = function () {
            var xhr = new XMLHttpRequest();
            var url = "http://localhost:8080/test.html";
            xhr.open("GET",url);
            xhr.send();
            xhr.onreadystatechange = function () {
                if(xhr.readyState == 4){
                    if(xhr.status == 200){
                        alert(xhr.responseText);
                    }
                }
            }
        }
    </script>
</head>
<body>

</body>
</html>